<!DOCTYPE html>
<html>
<div th:replace="common/jsCssRef :: jsfJsCssRef"></div>

<body class="bgf6">

<div th:replace="common/head :: jsfHeader"></div>

<div class="main-body pb100">
    <div class="container pt10" id="app">
        <div class="dflx sbt">
            <div class="body-right">
                <div class="bread-nav bgff">
                    <ul class="dflx">
                        <li><a href="###">速虎回收管理系统</a></li>
                    </ul>
                </div>

                <div class="bgff mt10 pb20">
                    <div class="wrap">
                        <form>
                            <input type="text" id="username"><br><br>
                            <input type="password" id="password"><br><br>
                        </form>
                        <button onclick="login()">登录</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">

    $(document).ready(function () {
        $('#homeLi').addClass('active');
    });
    
    function login() {
        $.ajax({
            'url' :'/user/login',
            'dataType' : 'json',
            'type' : 'post',
            'data' : {
                'username' : $('#username').val(),
                'password' : $('#password').val()
            },
            'success' : function (result) {
                if (result.code != 1000) {
                    alert(result.message);
                    return;
                }
                window.location.href = '/view/home';
            },
            'error' : function (result) {
            }
        });
    }

</script>
</body>
</html>
